/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved.
 */
package com.icinfo.cloud.provider.punish.controller;

import com.icinfo.cloud.common.core.page.PageResponse;
import com.icinfo.cloud.provider.common.constant.Constant;
import com.icinfo.cloud.provider.punish.api.client.ucase.casemain.CaseRelatedDocumentRecordClient;
import com.icinfo.cloud.common.core.page.PageResponse;
import com.icinfo.cloud.provider.punish.service.ICaseRelatedDocumentRecordService;
import com.icinfo.cloud.provider.punish.ucase.casemain.dto.CaseRelatedAppDocumentPageQueryDto;
import com.icinfo.cloud.provider.punish.ucase.casemain.dto.CaseRelatedAppDocumentPageQueryDto;
import com.icinfo.cloud.provider.punish.ucase.casemain.dto.CaseRelatedDocumentSaveDto;
import com.icinfo.cloud.provider.punish.ucase.casemain.dto.DocumentCatalogQueryDto;
import com.icinfo.cloud.provider.punish.ucase.casemain.vo.CaseRelatedAppDocumentVo;
import com.icinfo.cloud.provider.punish.ucase.casemain.vo.DocumentCatalogInfoVo;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.web.BaseController;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 【掌上办案V1.1】描述: 案件关联文书记录表 case_related_document_record 对应的Controller类.<br>
 *
 * @author framework generator
 * @date 2022年06月17日
 */
@RestController
@RequestMapping("/app/related/document")
public class CaseRelatedDocumentRecordController extends BaseController {
    /**
     * 日志记录器
     */
    private static final Logger logger = LoggerFactory.getLogger(CaseRelatedDocumentRecordController.class);

    @Resource
    private ICaseRelatedDocumentRecordService caseRelatedDocumentRecordService;


    /**
     * 【V1.3.0】描述：获取文书种类列表
     *
     * @author: zhengqiang
     * @date: 2022/6/29
     * @param: queryDto
     * @return {@link Result< List< DocumentCatalogInfoVo>>}
     **/
    @PostMapping("/getDocumentCatalogList")
    @ApiOperation(value = "【V1.0.0】描述：获取文书种类列表", httpMethod = "POST")
    public Result<List<DocumentCatalogInfoVo>> getDocumentCatalogList(@RequestBody @Validated DocumentCatalogQueryDto queryDto) {
        return caseRelatedDocumentRecordService.getDocumentCatalogList(queryDto);
        //return caseRelatedDocumentRecordClient.getDocumentCatalogList(queryDto);
    }

    /**
     * 【V1.11.4】描述：获取可关联文书列表
     *
     * @return {@link Result }
     * @author 孙洁飞
     * @date 2023/05/06
     */
    @PostMapping("/getRelatedDocumentList")
    @ApiOperation(value = "【V1.0.0】描述：获取可关联文书列表", httpMethod = "POST")
    public Result<PageResponse<CaseRelatedAppDocumentVo>> getCanRelatedDocumentList(@RequestBody @Validated CaseRelatedAppDocumentPageQueryDto queryDto) {
        return caseRelatedDocumentRecordService.getCanRelatedDocumentListByPartyAndHandle(queryDto);
    }
    /**
     * 【V1.3.0】描述：保存案件关联文书
     *
     * @return {@link Result }
     * @author shishengyao
     * @date 2022/06/15
     */
    @PostMapping("/saveCaseRelatedDocument")
    @ApiOperation(value = "【V1.0.0】描述：保存案件关联文书", httpMethod = "POST")
    public Result<String> saveCaseRelatedDocument(@RequestBody @Validated CaseRelatedDocumentSaveDto saveDto) {
        return caseRelatedDocumentRecordService.saveCaseRelatedDocument(saveDto);
    }
}
